//
//  HyqHelpController.swift
//  约麻
//
//  Created by rimi on 2017/7/20.
//  Copyright © 2017年 Sweet. All rights reserved.
//

import UIKit

class HyqHelpController: UITableViewController {
    var dataArr = [HyqMeModel]()
    override func viewDidLoad() {
        super.viewDidLoad()
        let nib = UINib(nibName: "HyqHelpCell", bundle: nil)
        tableView.register(nib, forCellReuseIdentifier: "helpCell")
        let path = Bundle.main.path(forAuxiliaryExecutable: "meinfo.plist")
        let arry = NSArray(contentsOfFile:path!)
        for dict in arry! {
            let model = HyqMeModel(dict: dict as! [String : String])
            dataArr.append(model)
            
            
        }
        tableView.reloadData()
        redui()
    }
    
    // MARK: - Table view data source
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return dataArr.count
    }
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "helpCell", for: indexPath) as! HyqHelpCell
        cell.setHelpModel = self.dataArr[indexPath.row]
        return cell
    }
    func redui(){
    navigationItem.title = "帮助"
    navigationController?.navigationBar.barTintColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
    //定义标题颜色与字体大小字典
    let dict:NSDictionary = [NSForegroundColorAttributeName: #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1),NSFontAttributeName : UIFont.boldSystemFont(ofSize: 15)]
    //标题设置颜色与字体大小
    navigationController?.navigationBar.titleTextAttributes = dict as? [String : AnyObject]
    
    let Btn = UIButton(frame: CGRect(x: 0, y: 0, width: 15, height: 15))
    Btn.setImage(UIImage.init(named:"黑色返回"), for: .normal)
    Btn.addTarget(self, action: #selector(backClicked), for: .touchUpInside)
    let back = UIBarButtonItem(customView: Btn)
    navigationItem.leftBarButtonItem = back
    
    }
    func backClicked() {
        self.dismiss(animated: true, completion: nil)
    }

    
}
